CREATE TABLE [dbo].[TDREPO_SUBT]
(
[CO_EMPR] [dbo].[TD_VC_002] NOT NULL,
[NU_ANNO] [dbo].[TD_IN_004_ANNO] NOT NULL CONSTRAINT [DF__TDREPO_SU__NU_AN__160F4887] DEFAULT (datepart(year,getdate())),
[CO_REPO] [dbo].[TD_VC_003] NOT NULL,
[CO_TITU] [dbo].[TD_VC_003] NOT NULL,
[CO_SUBT] [dbo].[TD_VC_003] NOT NULL,
[DE_SUBT] [dbo].[TD_VC_100] NULL,
[CO_USUA_CREA] [dbo].[TD_VC_008_USUA] NOT NULL,
[FE_USUA_CREA] [dbo].[TD_DT_001_SIST] NOT NULL CONSTRAINT [DF__TDREPO_SU__FE_US__17F790F9] DEFAULT (getdate()),
[CO_USUA_MODI] [dbo].[TD_VC_008_USUA] NOT NULL,
[FE_USUA_MODI] [dbo].[TD_DT_001_SIST] NOT NULL CONSTRAINT [DF__TDREPO_SU__FE_US__18EBB532] DEFAULT (getdate())
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TDREPO_SUBT] ADD CONSTRAINT [CK__TDREPO_SU__NU_AN__17036CC0] CHECK (([NU_ANNO]>=(0)))
GO
ALTER TABLE [dbo].[TDREPO_SUBT] ADD CONSTRAINT [XPKTDREPO_SUBT] PRIMARY KEY CLUSTERED  ([CO_EMPR], [NU_ANNO], [CO_REPO], [CO_TITU], [CO_SUBT]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TDREPO_SUBT] ADD CONSTRAINT [FK1_TDREPO_TITU_A_TDREPO_SUBT] FOREIGN KEY ([CO_EMPR], [NU_ANNO], [CO_REPO], [CO_TITU]) REFERENCES [dbo].[TDREPO_TITU] ([CO_EMPR], [NU_ANNO], [CO_REPO], [CO_TITU])
GO
